<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.ncp.model.biz.comment.CommentCl"%>
<%@page import="com.ncp.model.entity.comment.ProductComment"%>
<%@page import="com.ncp.model.biz.comment.CommentScoCl"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%
int id=1;
int nowPage=1;
if((String)request.getParameter("id")!=null){
	id=Integer.parseInt((String)request.getParameter("id"));
}
CommentCl cc=new CommentCl();
CommentScoCl csc=new CommentScoCl();
ArrayList<ProductComment> list=cc.getCommentInfo(id,nowPage);
ProductComment pc=null;
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>评论展示</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  <a href="pages/comment/product.jsp">return</a><br>
  平均分<%=csc.formatFloat(csc.getAvgSco(id) )%>
    <%
    for(int i=0;i<list.size();i++){
    	
    	 pc=list.get(i);
    	 if(!pc.getComment().equals("")){
    		 if(pc.getIsDisplayUserName()==1){
        		 %>
        		 	<div>用户<%=cc.getUsername(pc.getUserID())%>给出<%for(int j=0;j<5;j++) {
        		 		if(j<pc.getScore()){
        		 			%>
            	    		<img src="images/icon_star_1.gif">
            	    		<%
        		 		}else{
        		 			%>
            	    		<img src="images/icon_star_2.gif">
            	    		<%
        		 		}
    	    		
    	    	}
    	    	%>的评分<%=pc.getCommentTime() %></div>
        		 <%
        	 }else{
        		 %>
        		 <div>匿名用户给出<%for(int j=0;j<pc.getScore();j++) {
    	    		if(j<pc.getScore()){
        		 			%>
            	    		<img src="images/icon_star_1.gif">
            	    		<%
        		 		}else{
        		 			%>
            	    		<img src="images/icon_star_2.gif">
            	    		<%
        		 		}
    	    	}
    	    	%>的评分<%=pc.getCommentTime() %></div>
        		 <%
        	 }
        	%>
        
        	<div><%=pc.getComment() %></div>
        	<%
    	 }
    }
    %>
  </body>
</html>
